package com.fdb.efp.nls.service.impl.sx.zxruleforbd;

import com.fdb.cdp.pboc.service.vo.BdZxInfoVO;
import com.fdb.efp.rule.service.vo.ReqBdCreditRuleVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.stream.Stream;

/**
 * 贷款出现“呆账”，“资产处置”，“保证人代偿” <br>
 * <p>
 * 0.1:caoxin:2019/7/10 17:03: <br>
 * @author caoxin
 * @version 0.1
 * @date 2019/7/10 17:03
 * @since 2019/7/10 17:03
 */
@Service("bDZxRule06")
public class BDZxRule06 implements BdZxRuleInterface{
    @Override
    public void executeRule(ReqBdCreditRuleVo reqBdCreditRuleVo,BdZxInfoVO bdZxInfoVO) {
        Integer sum = Stream.of(bdZxInfoVO.getZxCreCardStatus5()).
                filter(StringUtils::isNotEmpty).
                filter(t -> {
            return  t.equals("呆账") || t.equals("担保人代还") || t.equals("以资抵债");
        }).map(e -> 1).reduce(0, Integer::sum);
        reqBdCreditRuleVo.setRule06(sum);
    }
}
